const mysql = require("mysql");

// 连接数据库
const client = mysql.createConnection({
  host: "localhost",
  user: "root",
  password: "root",
  port: 3306,
  database: "hkzf",
});

function clientFn(sql, arr, callback) {
  client.query(sql, arr, (error, result) => {
    if (error) {
      console.log("error", error);
      return;
    }
    callback(result);
    console.log("success");
  });
}

// 导出
module.exports = clientFn;
